<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:s="http://jboss.com/products/seam/taglib"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:a="http://richfaces.org/a4j">

	<h:panelGrid columns="2" columnClasses="top,top">
		<rich:fileUpload fileUploadListener="#{applicationBean.listener}"
			id="upload" maxFilesQuantity="#{applicationBean.uploadsAvailable}"
			immediateUpload="#{applicationBean.autoUpload}"
			allowFlash="#{applicationBean.useFlash}">
			<a:support event="onuploadcomplete" reRender="info" />
		</rich:fileUpload>
		<!-- http://livedemo.exadel.com/richfaces-demo/richfaces/fileUpload.jsf -->
		<h:panelGroup id="info">
			<rich:panel bodyClass="info">
				<f:facet name="header">
					<h:outputText value="#{messages['attachments.header']}" />
				</f:facet>
				<h:outputText value="#{messages['attachments.noFiles']}"
					rendered="#{applicationBean.size==0}" />
				<rich:dataGrid columns="1" value="#{applicationBean.files}"
					var="file" rowKeyVar="row">
					<rich:panel bodyClass="rich-laguna-panel-no-header">
						<h:panelGrid columns="2">
							<h:panelGrid columns="3">
								<h:outputText value="#{file.name}" />
								<h:commandLink value="#{messages['general.delete']}"
									action="#{applicationBean.delete(file)}" />
								<h:commandLink value="#{messages['general.download']}"
									action="#{applicationBean.download(file)}" />
							</h:panelGrid>
						</h:panelGrid>
					</rich:panel>
				</rich:dataGrid>
			</rich:panel>
			<rich:spacer height="3" />
			<br />
		</h:panelGroup>
	</h:panelGrid>
</ui:composition>